import request from "@/utils/request";

//获取房屋详细信息
export const getHouseall = id => {
  return request.get('/houses/'+id)
}

//房屋收藏
export const collectHouse = id => {
  return request.post('/user/favorites/'+id)
}

//移除房屋收藏
export const removeHouse = id => {
  return request.delete('/user/favorites/'+id)
}

//查看房屋收藏列表
export const getCollectList = () => {
  return request.get('/user/favorites')
}

// 房屋发布条件
export const getHouseList = () => {
  return request.get('/houses/params')
}

//查找地区所有房屋
export const getAreaHouse = (params) => {
  return request.get('/area/map',{params})
}

//头像上传
export const setPhoto = (data) => {
  let config = {
    headers:{'Content-Type':'multipart/form-data'}
};
  return request.post('/houses/image',data,config)
}

//发布房源
export const setHouse = (body) => {
  return request.post('/user/houses',{token:localStorage.getItem('my_token'),body})
}

//获取出租列表
export const getHireList = () => {
  return request.get('/user/houses')
}
